class EventBus:
    """事件总线，用于插件间通信"""
    def __init__(self):
        self.subscribers = {}
    
    def subscribe(self, event_type, callback):
        """订阅事件"""
        if event_type not in self.subscribers:
            self.subscribers[event_type] = []
        self.subscribers[event_type].append(callback)
    
    def publish(self, event_type, *args, **kwargs):
        """发布事件"""
        if event_type in self.subscribers:
            for callback in self.subscribers[event_type]:
                callback(*args, **kwargs)
